/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pl.tom.social.analyzer.graph;

import jade.tools.sniffer.MainPanel;
import java.util.List;
import java.util.Vector;
import org.openide.util.NbPreferences;

/**
 *
 * @author Tom
 */
public class SocialNetworkManager {

	private static SocialNetworkManager instance = null;
	private List<String> allowedServers = new Vector<String>();

	private SocialNetworkManager() {
		allowedServers.add("blog.onet.pl");
		//TODO uncomment for final release
//		String servers = NbPreferences.forModule(MainPanel.class).get("networkServers", null);
//		if(servers != null) {
//			String[] serversArray = servers.split(";");
//			for(String server : serversArray) {
//				allowedServers.add(server);
//			}
//		}
	}

	public static synchronized SocialNetworkManager getInstance() {
		if(instance == null) {
			instance = new SocialNetworkManager();
		}
		return instance;
	}

	public boolean isServerAllowed(String url) {
		for(String server : allowedServers) {
			if(url.contains(server)) {
				return true;
			}
		}
		return false;
	}
}
